nums = [1,5,3,6]

result = []
path = []
def backtracking(remain:list):
    if not remain:
        result.append(path[:])
    for num in remain:
        path.append(num)
        remain.remove(num)
        backtracking(remain)
        remain.insert(0,path.pop())

backtracking(nums)
print(result)